# -*- coding: utf-8 -*-
class Grant < ActiveRecord::Base
  belongs_to :employee      #操作人员。
  belongs_to :auditor , :class_name => 'Employee', :foreign_key => 'auditor_id'      #审批人员。
  belongs_to :receivable      #对应的预收
  belongs_to :sales_strategy  #销售策略

  scope :find_all, lambda { |conditionsStr,conditionsHash| { :conditions => [conditionsStr,conditionsHash],:include=>[:auditor,:employee,:receivable],:order=> "grants.updated_at DESC" }}
  scope :paginate, ->(start,limit) { offset(start.to_i).limit(limit.to_i)}
end
